import { createRouter, createWebHistory } from "vue-router"
import App from "@/App.vue"

// 路由规则
const routes = [
	{
		path: "/",
		component: App,
		children: [
			{ path: "", redirect: "/home" },
			{
				path: "/check",
				name: "check",
				component: () => import("@/views/check.vue")
			},
			{
				path: "/home",
				name: "home",
				component: () => import("@/views/home.vue")
			},
			{
				path: "/submit",
				name: "submit",
				component: () => import("@/views/submit.vue")
			},
			{
				path: "/result",
				name: "result",
				component: () => import("@/views/result.vue")
			}
		]
	}
]

const router = createRouter({
	// vueRouter@3版本的mode改成了history，hash模式配置createWebHashHistory，history模式配置createWebHistory
	history: createWebHistory(import.meta.env.VITE_BASE_PATH),
	routes
})

export default router
